<!---
 
  Copyright (c) 2010, Cristian Costantini - cristian@millemultimedia.it
  
  FileManager is licensed under the terms of the Open Source GPL 3.0 license. 
	
	http://www.gnu.org/licenses/gpl.html
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
--->

<cfcomponent output="false" extends="fileManager.util.Base">

	<cfset variables.STATIC = {} />

	<cffunction name="init" access="public" returntype="Component">
		<cfreturn this />
	</cffunction>

	<cffunction name="setEventmanager" access="public" returntype="void" >
		<cfargument name="eventManager" type="Component" required="true" />
		<cfset variables.eventmanager = arguments.eventManager />
	</cffunction>
	
	<cffunction name="setSessionMgr" access="public" returntype="void" >
		<cfargument name="sessionMgr" type="Component" required="true" />
		<cfset variables.sessionMgr = arguments.sessionMgr />
	</cffunction>
	
	<cffunction name="validatePermission" access="public" returntype="void" >
		<cfargument name="name" type="string" required="true" />
		
		<cfif variables.sessionMgr.getValue('config').permissions EQ "*">
			<cfreturn />
		<cfelse>
		
		<cfif NOT listFindNoCase( variables.sessionMgr.getValue('config').permissions, arguments.name, chr(44) ) >
			<cfthrow message="Access denied to #arguments.name# operation." detail="Not have a permissions for this Operation." />
		</cfif>
		
		</cfif>
		
	</cffunction>
	
	<cffunction name="getAbsolutePath" access="private" returntype="String" >
		<cfargument name="path" type="String" required="false" default="" />
		<cfreturn variables.sessionMgr.getValue('config').absolutePath & arguments.path />
	</cffunction>
	
	<cffunction name="getBasePath" access="private" returntype="String" >
		<cfreturn variables.sessionMgr.getValue('config').basePath />
	</cffunction>	

</cfcomponent>